/*
 * Thach Nguyen
 */
package data;


public class ClassPreference {
	
	private  final String myClassNum;
	
	private final String myClassTitle;
	
	private char myClassSection;
	
	private final int myClassCredits;
	
	
	/**
	 * Constructs a ClassSlot object.
	 * 
	 */
	public ClassPreference(final String theClassNum, final String theClassTitle,
						   final char theClassSection, final int theClassCredits) {
		myClassNum = theClassNum;
		myClassTitle = theClassTitle;
		myClassSection = theClassSection;
		myClassCredits = theClassCredits;
	}
	
	/**
	 * Returns the class number.
	 */
	public String getClassNum()
	{
		return myClassNum;
	}
	
	/**
	 * Returns the class title.
	 */
	public String getClassTitle()
	{
		return myClassTitle;
	}
	
	/**
	 * @return This class is A or B
	 */
	public char getClassSection() {
		return myClassSection;
	}
	
	/**
	 * Returns the class credits.
	 */
	public int getClassCredits()
	{
		return myClassCredits;
	}
	
	@Override
	public boolean equals(final Object theOther) {
		boolean result = false;
	    if (this == theOther)
	    {
	      result = true;
	    }
	    else if (theOther != null && theOther instanceof ClassPreference)
	    {
	      final ClassPreference temp = (ClassPreference) theOther;
	      result = (myClassNum.equals(temp.myClassNum)) && (myClassTitle.equals(temp.myClassTitle)) &&
	      		   (myClassSection == temp.myClassSection) && (myClassCredits == temp.myClassCredits);
	    }
	    return result;
	}
	
	/**
	 * {@inheritDoc}
	 */
	@Override
	public int hashCode() {
		return myClassNum.hashCode() + myClassTitle.hashCode() + myClassCredits;
	}

}
